<script setup>

import Comp1 from "./Comp1.vue";
import Comp2 from "./Comp2.vue";
import {ref} from "vue";

let status1 = ref(false)    // 控制 Comp1 组件的显示
let status2 = ref(false)    // 控制 Comp2 组件的显示

function comp1Clicked() {
  status1.value  = true
  status2.value = false
}

function comp2Clicked() {
  status1.value = false
  status2.value = true
}
</script>

<template>
  <button v-on:click="comp1Clicked">Comp1</button>
  <button v-on:click="comp2Clicked">Comp2</button>
  <comp1 v-show="status1"></comp1>
  <comp2 v-show="status2"></comp2>
</template>

<style scoped>

</style>